package com.example.larou.Impl;

import cn.dev33.satoken.util.SaResult;
import com.example.larou.entity.User;
import com.example.larou.mapper.UserMapper;
import com.example.larou.utils.Adapter;
import com.example.larou.utils.Result;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class RegisterServiceImpl extends Adapter {
    @Resource
    private UserMapper userMapper;

    @Override
    public SaResult RegisterService(User user){
        if (userMapper.getEmail(user.getEmail())==null) {
            boolean  users= userMapper.Register(user.getEmail(),user.getPassword(),user.getUsername(),user.getPhone_number() );
            System.err.println(users);
            if (users==true) {
               return SaResult.ok("注册成功");
            }
        }
        return SaResult.error("注册失败");
    }
}

